<!--
* description: 索赔单选择弹框
* createdDate:
-->
<template>
  <section class="bigAreaInp">
    <el-col :span="span">
      <lableName
        :cur-label-name="curLabelName"
        :is-show-label="isShowLabel"
        :is-require="isRequire"
      />

      <el-input
        v-model="modelCode"
        :placeholder="placeholder"
        :disabled="disabled"
        size="small"
        suffix-icon="el-icon-search"
        clearable
        readonly
        @blur="sendCode"
        @focus="getFocusCode"
        @clear="clearCode"
      />

      <validateFormate
        :cur-label-name="curLabelName"
        :validrule="validrule"
      />
    </el-col>

    <claimSelectDialog
      ref="salesStore"
      :key="editPopupsKey"
      :popups-visible="curPopupsVisible"
      :code-field="codeField"
      :com-type="comType"
      :popups-key="popupsKey"
      :data-for-form="editRowData"
      :code="modelCode"
      :text="modelText"
      :value-object="curValueObject"
      :is-mul="isMul"
      @chooseValue="chooseValue"
      @changeCode="getComponentCode"
      @close="close"
    />
  </section>
</template>
<script>
import { searchInputMixins } from '@/components/mixins/searchInputMixins'
import { valueObjectMixins } from '@/components/mixins/valueObjectMixins'
import claimSelectDialog from './claimSelectDialog'

export default {
  name: 'SalesStoreInput',

  components: {
    claimSelectDialog,
    lableName: () => import('@/components/lableName'), // 标题溢出样式组件
    validateFormate: () => import('@/components/validateFormate') // 校验提示样式组件
  },
  // 组件混入对象
  mixins: [searchInputMixins, valueObjectMixins],

  data() {
    return {
      curPopupsVisible: false,
      editPopupsKey: '',
      editRowData: {},
      placeholder: '索赔单号',
      curLabelName: this.labelName === '' ? '备件名称：' : this.labelName
    }
  },

  watch: {

  },

  methods: {
    getFocusCode() {
      this.curPopupsVisible = true
      this.$nextTick(() => {
        // 加载dialog中的数据
        this.$refs['salesStore'].queryTable(1)
      })
    //   this.$refs['salesStore'].list = [{
    //             index: 1,
    //             wiAmount: 222
    //         }]
    },

    close() {
      this.curPopupsVisible = false
    },

    chooseValue(val) {
      // this.modelCode = val.claimCode
    //   const id = val.partNameId
      // this.$parent.$parent.$parent.formField.claimCode = this.modelCode

      // console.log(val,'aaa')
      this.$parent.$parent.$parent.chooseList = val
    }
  }
}
</script>
